package entities;

import javax.persistence.*;

import java.io.Serializable;
import java.util.*;

@Entity
@Table(name="help_request")
public class HelpRequest implements Serializable {

	@Id
	private String id;
	
	@ManyToOne
	@JoinColumn(name="sender", referencedColumnName="userId")
	private RegisteredUser sender;
	
	@ManyToOne
	@JoinColumn(name="receiver", referencedColumnName="userId")
	private RegisteredUser receiver;
	
	@ManyToOne
	@JoinColumn(name="ability", referencedColumnName="name")
	private Ability ability;
	
	private boolean answer;
	private boolean pending;
	private Date date;
	private String place;
	private String description;
	private double retribution;
	private String eMail;
	
	
	public HelpRequest(RegisteredUser sender, RegisteredUser receiver,
			Ability ability, Date date, String place, String description,
			double retribution) {
		super();
		this.sender = sender;
		this.receiver = receiver;
		this.ability = ability;
		this.date = date;
		this.place = place;
		this.description = description;
		this.retribution = retribution;
		id = "" + System.nanoTime();
		pending = true;
		answer = false;
		eMail = null;
	}


	public HelpRequest() {
		// TODO Auto-generated constructor stub
	}


	public boolean getAnswer() {
		return answer;
	}


	public void setAnswer(boolean answer) {
		this.answer = answer;
	}


	public boolean isPending() {
		return pending;
	}


	public void setPending(boolean pending) {
		this.pending = pending;
	}


	public String getId() {
		return id;
	}


	public RegisteredUser getSender() {
		return sender;
	}


	public RegisteredUser getReceiver() {
		return receiver;
	}


	public Ability getAbility() {
		return ability;
	}


	public Date getDate() {
		return date;
	}


	public String getPlace() {
		return place;
	}


	public String getDescription() {
		return description;
	}


	public double getRetribution() {
		return retribution;
	}
	
	public void setEMail(String eMail){
		this.eMail = eMail;
	}
	
	public String getEmail(){
		return eMail;
	}
	
}
